home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STRCSPN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  451 b   |  18 lines

  1. /* strcspn.c From TC Bible page 280  Use strcspn to locate the position
  2. of the first occurance in a string of any character from another. */
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6. char *digits = "0123456789";
  7. main()
  8. {
  9.     int loc;
  10.     char str1[80];
  11.     printf("Enter a number followed by other \ characters: ");
  12.     gets(str1);
  13.     loc = strcspn(str1, digits);
  14.     printf("First non-numeric character in \
  15.     \n%s\nis at location %d\n",str1, loc);
  16.  
  17. }
  18.